﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ProjectSem3
{
    public partial class WebForm6 : System.Web.UI.Page
    {
        private DataClassesHealthDataContext dc = new DataClassesHealthDataContext();
        protected void Page_Load(object sender, EventArgs e)
        {
            ultext.Visible = true;
            likq.Visible = false;
            if (!Page.IsPostBack)
            {
                var atc = this.dc.Articals.Single(a => a.categoryID.Equals(2));
                this.LabelContact.Text = atc.content;
            }
        }

        protected void ButtonSend_Click(object sender, EventArgs e)
        {
            string name = this.TextBoxName.Text;
            string email = this.TextBoxEmail.Text;
            string contact = this.TextBoxContact.Text;
            string subject = this.TextBoxSubject.Text;
            string message = this.TextBoxMessage.Text;
            themcontact(name, email, contact, subject, message);
            ultext.Visible = false;
            likq.Visible = true;
        }

        public void themcontact(string name, string email, string contact, string subject, string message)
        {
            Contact ct = new Contact();
            ct.name = name;
            ct.email = email;
            ct.contactno = contact;
            ct.subject = subject;
            ct.message = message;
            this.dc.Contacts.InsertOnSubmit(ct);
            this.dc.SubmitChanges();
        }
    }
}